<?php
$file_name = "../ptnhuan-web1/data/films.txt"; 

$file_path = realpath($file_name);
$films = array();
// doc file 
//khai bao
$file = fopen($file_path, "r");
//lay du lieu
while (!feof($file)){
    $films [] = trim(fgets($file));
}
//dong file
fclose($file);
?>

<?php foreach ($films as $line): ?>
    <?php if (!empty($line)): //xoa dong trong?>
        <?php $film = explode(";", $line); ?>
        <img src='../ptnhuan-web1/public/images/films/<?php echo $film[1]; //xuat thong tin  ?>'>
        <?php echo $film[0]; ?>
        <?php echo $film[2]; ?>
        <?php echo $film[3]; ?>
        <a href="edit.php?if=<?php echo $film[0] ?>">Edit</a><br>
    <?php endif; ?>
<?php endforeach; ?>



